Skip to content

Conversation

@calavera
Copy link
Contributor

@calavera calavera commented Apr 3, 2022

Issue #, if available:

Fixes #77

Description of changes:

Cargo-Lambda includes a very straightforward command to run lambda locally.

By submitting this pull request

  • I confirm that my contribution is made under the terms of the Apache 2.0 license.
  • I confirm that I've made a best effort attempt to update all relevant documentation.

Cargo-Lambda includes a very straightforward command to run lambda locally.
@calavera calavera requested a review from nmoutschen April 3, 2022 20:39
@brainstorm
Copy link

Thanks for this @calavera!

I'm back from holidays and I just tested cargo-lambda on my M1, thanks for this! One nitpick on the docs though... it seems that I have to pass bootstrap as the lambda name? See my rust-lambda example here: https://github.com/umccr/s3-rust-noodles-bam#with-cargo-lambda

Namely:

$ cargo lambda start
$ cargo lambda invoke bootstrap --data-file event.json

I wonder if the bootstrap name could be obviated as it might confuse new users that don't know that's the actual lambda bin name?

@calavera
Copy link
Contributor Author

calavera commented Apr 4, 2022

@brainstorm the first argument is the name of the binary to run as a function. Yes, in your case, it's bootstrap because that's the name you gave the binary in https://github.com/umccr/s3-rust-noodles-bam/blob/master/Cargo.toml#L26. This is necessary because a package might include multiple binaries, and we need to know then name of the binary to watch changes for. The invoke command can be run from any directory, so we need a way to know which lambda you want to run

You don't actually need that section in your Cargo.toml at all when working with cargo-lambda. You could remove it, and run this:

$ cargo lambda start
$ cargo lambda invoke s3-rust-noodles-bam --data-file event.json

Then cargo lambda build will create a binary named bootstrap, regardless which name you give the package or binary.

Don't hesitate to open issues in that project if you have ideas to improve the experience.

brainstorm added a commit to brainstorm/s3-rust-noodles-bam that referenced this pull request Apr 4, 2022
Copy link
Contributor

@nmoutschen nmoutschen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@nmoutschen nmoutschen merged commit 7c4032c into main Apr 4, 2022
@nmoutschen nmoutschen deleted the document_local_development branch April 4, 2022 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Documentation: Running locally

3 participants